#pragma once

template<typename T>
class Singleton
{
protected:
	static T* m_instance;
public:
	Singleton()
	{
		m_instance = (T*)this;
	}

	static T* GetInstance() { return m_instance; }
};

class StartupException
{
public:
	std::string szTitle;
	std::string szBody;
};

#define		MESH_TYPE_PART_M2		0x01
#define		MESH_TYPE_PART_WMO		0x02

#define		MESH_TYPE_PART_NONE		0xFF

inline DWORD FToDW(float in)
{
	return *(DWORD*)&in;
}

extern D3DXMATRIX matID;

class Log
{
public:
	static void Print(const char* format, ...);
};

class Math
{
public:
	static const float sqrt2;
	static const float PI;
	static double SqrtTable[1000000];
	static double QuadTable[1000000];
	static void Init();
};

enum ApplicationState
{
	STATE_MENU,
	STATE_MINIMAP,
	STATE_WORLD,
	STATE_LOADING,
	STATE_AGREEMENT,
};

#ifdef _DEBUG
#define NOINLINE __declspec(noinline)
#else
#define NOINLINE 
#endif

extern std::string helpTerrain;
extern std::string helpPanel;
extern std::string helpTexSel;

enum Tutorials
{
	TUTORIAL_TERRAIN_CLICK,
	TUTORIAL_PANEL_HOVER,
	TUTORIAL_TEXTURE_SELECTION,

	NUM_TUTORIALS,
};

class WoWFolder
{
public:
	static std::string GetWoWPath();
	static std::string GetLocale();
	static bool GetWoWVersion(ui32& version);
};